 /**
 * All rights Reserved, Designed By senior.auto
 * @Title: SwaggerConfiguration.java
 * @Package com.example.demo.config
 * @Description: swagger配置类
 * @author: xiongzhengsheng
 * @date: 2021年1月21日 下午3:17:17
 * @version: V1.0
 * @Copyright: 2021 senior.auto Inc. All rights reserved.
 *
 */
package com.example.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @ClassName: SwaggerConfiguration
 * @Description: swagger配置
 * @author: xiongzhengsheng
 * @date: 2021年1月21日 下午3:33:08
 * @Copyright: 2021 senior.auto Inc. All rights reserved.
 *
 */
@Configuration
@EnableSwagger2
@EnableKnife4j
public class SwaggerConfiguration {

    @Bean
    public Docket createRestApi() {
        return  new Docket(DocumentationType.SWAGGER_2)
                .useDefaultResponseMessages(false)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.senior.cloud.system.controller"))
                .paths(PathSelectors.any())
                .build();

    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("example demo RESTful APIs")
                .description("example demo")
                .termsOfServiceUrl("http://localhost:8080/")
                .version("1.0")
                .build();
    }
}
